﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using SPMS.Log.Core;

namespace SPMS.Log.Formatter
{
    /// <summary>
    /// 日志格式化器接口
    /// </summary>
    /// <remarks>用于将日志条目格式化为文字描述信息</remarks>
    /// <history>
    /// [zanezeng]               2009/9/28 11:16    创建
    /// </history>
    public interface IFormatter
    {
        #region ---Property

        /// <summary>
        /// 获得日志记录的页头
        /// </summary>
        /// <value>日志记录的页头</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/28 11:17    创建
        /// </history>
        string Header
        {
            get;
        }

        /// <summary>
        /// 获得日志记录的页脚
        /// </summary>
        /// <value>日志记录的页脚</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/28 11:19    创建
        /// </history>
        string Footer
        {
            get;
        }

        #endregion

        #region ---Method

        /// <summary>
        /// 将给定的日志条目按照一个有序的字符串序列记录到给定的字符串写入器中
        /// </summary>
        /// <param name="writer">用于记录日志信息的字符串写入器</param>
        /// <param name="entry">要进行格式化的日志记录</param>
        /// <remarks></remarks>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/>为<c>null</c>引用</exception>
        /// <exception cref="ArgumentNullException"><paramref name="entry"/>为<c>null</c>引用</exception>
        /// <history>
        /// [zanezeng]               2009/9/28 11:20    创建
        /// </history>
        void Format( TextWriter writer, LogEntry entry );

        /// <summary>
        /// 将给定的日志条目格式化为一个有序的字符串序列
        /// </summary>
        /// <param name="entry">要进行格式化的日志记录</param>
        /// <returns>描述给定日志记录的一个有序的字符串序列</returns>
        /// <remarks></remarks>
        /// <exception cref="ArgumentNullException"><paramref name="entry"/>为<c>null</c>引用</exception>
        /// <history>
        /// [zanezeng]               2010/1/13 10:03    创建
        /// </history>
        string Format( LogEntry entry );

        #endregion
    }
}
